import { RouteRecordRaw, RouteComponent } from 'vue-router';

const files: RouteComponent = import.meta.glob(
	'../../../views/test_page/*/*.vue',
	{ eager: true }
);
const routes: Array<RouteRecordRaw> = [];
for (const i in files) {
	const newName: string = i.match(/views\/([\w-]+)\/([\w-]+)/)![2] as string;
	routes.push({
		path: `/${newName.toLocaleLowerCase()}/${i.match(/\/([^/]+)\.[^.]+$/)![1]}`,
		name: `${newName}/${i.match(/\/([^/]+)\.[^.]+$/)![1]}`,
		component: files[i],
	});
}
export default routes;
